﻿
using Chain.BLL;
using Chain.Model;
using System;
using System.Data;
using System.Text.RegularExpressions;
using System.Web.UI;
using System.Web.UI.HtmlControls;

public partial class redpocket : Page
    {
        private Chain.BLL.Mem MemIBll = new Chain.BLL.Mem();
        private Chain.BLL.MemLevel MemLevelBll = new Chain.BLL.MemLevel();
        protected int num = 0;

        protected void Page_Load(object sender, EventArgs e)
        {
            if ((base.Request.Cookies["uid"] != null) && Regex.IsMatch(base.Request.Cookies["uid"].Value, @"^\d+$"))
            {
                int MemID = Convert.ToInt32(base.Request.Cookies["uid"].Value);
                Chain.Model.Mem MemModel = this.MemIBll.GetModel(MemID);
                //this.spMemPoint.InnerText = MemModel.MemPoint.ToString();
                //this.spMemMoney.InnerText = MemModel.MemMoney.ToString("0.00");
                this.spMemSm.InnerText = MemModel.SmallChange.ToString("0.00");
                //this.spMemConsumeMoney.InnerText = MemModel.MemConsumeMoney.ToString("0.00");
                Chain.Model.MemLevel MemLevelModel = this.MemLevelBll.GetModel(MemModel.MemLevelID);
                //this.spLevelName.InnerText = MemLevelModel.LevelName;
                Chain.BLL.SysParameter BllSysParameter = new Chain.BLL.SysParameter();
                DataSet ds = BllSysParameter.GetAllList();
                if (ds.Tables[0].Rows.Count > 0 && ds.Tables[0].Rows[0]["IsDepositToWxRedPocket"] != DBNull.Value && (int)ds.Tables[0].Rows[0]["IsDepositToWxRedPocket"] == 0)
                {
                    this.button_1.Visible = false;
                }
                Chain.BLL.WxRedPacketsList BllWxRedPacketsList = new Chain.BLL.WxRedPacketsList();
                ds = BllWxRedPacketsList.GetList_Count(" memid=" + MemID.ToString() + " and DateDiff(dd,datetime,getdate())=0  and state=1");
                int _rednum = 0;
                if (ds.Tables[0].Rows.Count > 0)
                {
                    _rednum = (int)ds.Tables[0].Rows[0][0];
                }
                ds = BllSysParameter.GetAllList();
                int rednum = 0;
                if (ds.Tables[0].Rows[0]["DepositLimitTimes"] != DBNull.Value)
                {
                    rednum = (int)ds.Tables[0].Rows[0]["DepositLimitTimes"];
                }
                num = rednum - _rednum;
            }
        }
    }


